<template>
  <div class="contextForm">
    <Form :model="formItem" :label-width="120" class="consumerForm" label-position="left">
      <div class="item-title">个人信息</div>
      <FormItem label="头像">
        <div style="width:100px;height:120px">
          <img
            :src="workerInfo.worker_avatar?workerInfo.worker_avatar:'http://image.chihe.so/shop/sign/2014/10/15/default_sign.jpg'"
            style="height:100%"
          >
        </div>
      </FormItem>
      <FormItem label="姓名">
        <span>{{workerInfo.worker_nickname}}</span>
      </FormItem>
      <FormItem label="性别">
        <span>{{gender[workerInfo.worker_gender - 1]}}</span>
      </FormItem>
      <FormItem label="出生日期">
        <span>{{workerInfo.worker_birthday}}</span>
      </FormItem>
      <FormItem label="联系电话">
        <span>{{workerInfo.worker_phone}}</span>
      </FormItem>
      <FormItem label="最高学历">
        <span>{{educationArr[workerInfo.worker_education]}}</span>
      </FormItem>
      <FormItem label="工作经验">
        <span>{{experienceArr[workerInfo.worker_experience] !=0?(experienceArr[workerInfo.worker_experience]+'年'):experienceArr[workerInfo.worker_experience]}}</span>
      </FormItem>
      <FormItem label="工作状态">
        <span>{{workerStates[workerInfo.worker_demand_status -1]}}</span>
      </FormItem>
      <div class="item-title">求职意向</div>
      <div class="allMi">
        <div class="miBlock" v-for="(item,index) in workerInfo.workerDemandList" :key="index">
          <!-- <div class="miCon">
            <div class="miLeft">工作性质</div>
            <div class="miRight">{{jobTypeArr[item.]}}</div>
          </div>-->
          <div class="miCon">
            <div class="miLeft">期望薪资</div>
            <div class="miRight">{{item.salary_min + '~' + item.salary_max + '元'}}</div>
          </div>
          <!-- <div class="miCon">
            <div class="miLeft">工作地点</div>
            <div class="miRight">{{item.}}</div>
          </div>-->
          <div class="miCon">
            <div class="miLeft">期望职位</div>
            <div class="miRight">{{item.position_title}}</div>
          </div>
        </div>
      </div>
      <div class="item-title">工作经历</div>
      <div class="allMi">
        <div v-for="(item,index) in workerInfo.experienceList" :key="index" style="border-right:1px solid gray;padding-right:20px">
          <FormItem label="公司名称">
            <span>{{item.company}}</span>
          </FormItem>
          <FormItem label="职位名称">
            <span>{{item.position}}</span>
          </FormItem>
          <FormItem label="在职时间">
            <span>{{item.date_entry + '~' + item.date_resignation}}</span>
          </FormItem>
          <FormItem label="工作内容" style="margin-bottom:50px">
            <text>{{item.worker_description}}</text>
          </FormItem>
        </div>
      </div>
      <FormItem>
        <Button type="primary" @click="back">返回</Button>
      </FormItem>
    </Form>
  </div>
</template>

<script>
import { WorkderEdit } from "api/recuit/resume";

export default {
  name: "",
  data() {
    return {
      formItem: {
        radio: "",
        input: ""
      },
      gender: ["男", "女"],
      jobTypeArr: ["全职", "兼职", "钟点工"],
      educationArr: [
        "未知",
        "小学",
        "初中",
        "中专",
        "高中",
        "大学专科",
        "大学本科",
        "硕士",
        "博士",
        "博士后",
        "其它"
      ],
      experienceArr: [
        "无经验",
        "1年",
        "2年",
        "3年",
        "4年",
        "5年",
        "6年",
        "7年",
        "8年",
        "9年",
        "10年"
      ],
      workerStates: [
        "在职_不考虑",
        "在职_考虑机会",
        "在职_月内到岗",
        "离职_随时到岗"
      ],
      worderId: "", //简历ID
      workerInfo: {} //简历信息
    };
  },
  components: {},
  mounted() {
    let worderId = this.$route.params.worderId
    this.worderId = worderId;
    this.getData(worderId);
  },
  methods: {
    getData(worderId) {
      WorkderEdit({ worderId })
        .then(result => {
          console.log(result, 123);
          this.workerInfo = result;
        })
        .catch(err => {
          this.$Message.error(err);
        });
    },
    //返回上一页
    back(){
      this.$router.go(-1);//返回上一层
    }
  }
};
</script>

<style scoped lang="less">
.contextForm {
  padding: 2%;
  background: white;
  .item-title {
    margin-bottom: 20px;
    padding: 8px 16px;
    font-weight: bolder;
    background-color: #f5f5f5;
    color: #333;
  }
  .alert {
    color: rgb(153, 153, 153);
    margin-top: 15px;
  }
  .ivu-form-item {
    margin-bottom: 15px;
    margin-left: 35px;
  }
  .allMi {
    width: 100%;
    display: flex;
    flex-flow: wrap;
    align-items: center;
    .miBlock {
      width: 300px;
      height: 160px;
      display: flex;
      flex-direction: column;
      border: 1px solid rgb(194, 194, 194);
      margin: 0 20px 20px 35px;
      .miCon {
        width: 100%;
        padding: 10px;
        display: flex;
        justify-content: center;
        align-items: center;
        div {
          flex: 1;
          text-align: left;
        }
      }
    }
  }
}
</style>
